import {BrowserWindow, ipcMain} from 'electron'

let mainWindow = null

const mainWindowURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080/#/platform` : `file://${__dirname}/index.html#/platform`

export function createMainWindow() {
    if (mainWindow == null) {
        mainWindow = new BrowserWindow({
            autoHideMenuBar: true,
            height: 663,
            useContentSize: true,
            width: 1360
        })

        mainWindow.loadURL(mainWindowURL)

        mainWindow.webContents.openDevTools()
        mainWindow.on('closed', () => {
            mainWindow == null
        })
    } else {
        mainWindow.show()
    }

}

